package com.example.component;

import com.example.FlowContext;
import com.example.domain.Brand;
import com.example.domain.Product;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;

@LiteflowComponent
public class RemoteCallerCmp {

    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "brandSelector", nodeName = "查询品牌信息")
    public void brandSelector(NodeComponent bindCmp) {
        FlowContext contextBean = bindCmp.getContextBean(FlowContext.class);
        contextBean.setBrand(new Brand("Apple", "apple is good"));
    }

    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "productSelector", nodeName = "查询商品信息")
    public void productSelector(NodeComponent bindCmp) {
        FlowContext contextBean = bindCmp.getContextBean(FlowContext.class);
        contextBean.setProduct(new Product(contextBean.getProductId(), "iPhone15", 7999.00, "gold"));
    }

}
